#include<bits/stdc++.h>
#define int long long
#define For(i,a,b) for(int i=a;i<=b;++i)
#define Rof(i,a,b) for(int i=a;i>=b;--i)
#define rep(i,a) for(int i=1;i<=a;++i)
#define print(x) printf("%lld\n",(int)x)
#define prn(x) printf("%lld ",(int)x)
using namespace std;
const int N=2e4+5,Mod=998244353;
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(!isdigit(ch)){f=(ch=='-'?-f:f);ch=getchar();}
	while(isdigit(ch)){x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
	return x*f;
}
int n;
int cnt;
int k[N];
vector<pair<int,int> >q[N];
signed main(){
	freopen("road.in","r",stdin);
	freopen("road.out","w",stdout);
	n=read();
	int p=n,x=0;
	while(p){
		x++;
		p/=2;
	}
	cnt=2;
	q[1].push_back({2,0});
	For(i,2,x-1){
		q[cnt].push_back({cnt+1,0});
		q[cnt].push_back({cnt+1,(1<<(x-i))});
		cnt++;
	}
	q[cnt].push_back({114,0});
	q[cnt].push_back({114,1});
	int res=(n&(1<<(x-1)));
	Rof(i,x-2,0){
		if(n&(1<<(i))){
			//~ cout<<x-i<<" "<<res<<endl;
			q[1].push_back({(1+(x-i)==cnt+1?114:1+(x-i)),res});
		}
		res+=(n&(1<<(i)));
	}
	int m=0;
	q[1].push_back({114,res});
	For(i,1,cnt)m+=q[i].size();
	printf("%lld %lld\n",cnt+1,m);
	For(i,1,cnt){
		for(auto E:q[i]){
			printf("%lld %lld %lld\n",i,E.first,E.second);
		}
	}
	return 0;
}
//
